package com.abvnet.project.water.sewage.service;

import com.abvnet.common.utils.security.ShiroUtils;
import com.abvnet.common.utils.text.Convert;
import com.abvnet.project.water.sewage.domain.SewageFlow;
import com.abvnet.project.water.sewage.mapper.SewageFlowMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 流程处理单元 服务层实现
 * 
 * @author duj
 * @date 2019-07-19
 */
@Service
public class SewageFlowServiceImpl implements ISewageFlowService {
	@Autowired
	private SewageFlowMapper sewageFlowMapper;

	/**
     * 查询流程处理单元信息
     * 
     * @param flowId 流程处理单元ID
     * @return 流程处理单元信息
     */
    @Override
	public SewageFlow selectSewageFlowById(Integer flowId) {
	    return sewageFlowMapper.selectSewageFlowById(flowId);
	}
	
	/**
     * 查询流程处理单元列表
     * 
     * @param sewageFlow 流程处理单元信息
     * @return 流程处理单元集合
     */
	@Override
	public List<SewageFlow> selectSewageFlowList(SewageFlow sewageFlow) {
	    return sewageFlowMapper.selectSewageFlowList(sewageFlow);
	}
	
    /**
     * 新增流程处理单元
     * 
     * @param sewageFlow 流程处理单元信息
     * @return 结果
     */
	@Override
	public int insertSewageFlow(SewageFlow sewageFlow) {
        sewageFlow.setCreateBy(ShiroUtils.getLoginName());
	    return sewageFlowMapper.insertSewageFlow(sewageFlow);
	}
	
	/**
     * 修改流程处理单元
     * 
     * @param sewageFlow 流程处理单元信息
     * @return 结果
     */
	@Override
	public int updateSewageFlow(SewageFlow sewageFlow) {
        sewageFlow.setUpdateBy(ShiroUtils.getLoginName());
	    return sewageFlowMapper.updateSewageFlow(sewageFlow);
	}

	/**
     * 删除流程处理单元对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deleteSewageFlowByIds(String ids) {
		return sewageFlowMapper.deleteSewageFlowByIds(Convert.toStrArray(ids));
	}

    @Override
    public List<SewageFlow> selectSewageFlowListByProjectId(Long projectId) {
        return sewageFlowMapper.selectSewageFlowListByProjectId(projectId);
    }
}